//
//  ViewController.m
//  CreditCommunity
//
//  Created by maiya on 2017/10/11.
//  Copyright © 2017年 maiya. All rights reserved.
//

#import "ViewController.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self setupUI];
}

- (void)setupUI {
    UIButton *btn = [[UIButton alloc] init];
//    btn.frame = CGRectMake(0, 0, 0, 40);
    btn.backgroundColor = [UIColor lightGrayColor];
    [btn setTitle:@"发起请求" forState:UIControlStateNormal];
    [btn setTitleColor:[UIColor blueColor] forState:UIControlStateNormal];
    [btn setTitleColor:[UIColor redColor] forState:UIControlStateHighlighted];
    [btn addTarget:self action:@selector(btnButton) forControlEvents:UIControlEventTouchUpInside];
    
    [self.view addSubview:btn];
    
    [btn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.size.mas_equalTo(CGSizeMake(150, 40));
        make.center.equalTo(self.view);
    }];
}

- (void)btnButton {
    
    [HTAPICommonTools POST:@"https://www.baidu.com" parameters:nil success:^(id responseObject) {

        NSLog(@"%@", responseObject);
    } failure:^(id error) {
        NSLog(@"%@", error);
    } netError:^(NSString *netError) {
       NSLog(@"%@", netError);
    }];
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


@end
